﻿package org.dm.3d.geom 
{
	
	/**
	 * ...
	 * @author Scott
	 */
	public class Num3D 
	{
		public var x:Number;
		public var y:Number;
		public var z:Number;
		
		public function Num3D(px:Number=0,py:Number=0,pz:Number=0) 
		{
			x = px;
			y = py;
			z = pz;
		}
		public function clone():Num3D
		{
			return new Num3D( this.x, this.y, this.z );
		}
		public function add(v:Num3D):Num3D
		{
			return new Num3D(this.x + v.x, this.y + v.y, this.z + v.z);
		}
		public function subtract(v:Num3D):Num3D
		{
			return new Num3D(this.x - v.x, this.y - v.y, this.z - v.z);
		}
		public function scaleBy(s:Number):void 
		{
			//if (Math.abs(s) < .000001) return;
			this.x *= s;
			this.y *= s;
			this.z *= s;
		}
		public function decrementBy(v:Num3D):void 
		{
			this.x -= v.x;
			this.y -= v.y;
			this.z -= v.z;
		}
		public function incrementBy(v:Num3D):void 
		{
			this.x += v.x;
			this.y += v.y;
			this.z += v.z;
		}
		public function negate():void 
		{
			x = -x;
			y = -y;
			z = -z;
		}
	}
	
}